#ifndef JERUK_SCANNER_H
#define JERUK_SCANNER_H

#include <stdio.h>
#include "bstrlib.h"
#include "global.h"

#define BUFFER_SIZE 1024

typedef struct Input {
  FILE* finput;
  UINT line;
  CHAR *start, *cursor, *marker, *limit;
  CHAR* buffer_end;
  CHAR* buffer;
} Input;

typedef struct Keyword {
  char *name;
  UINT token;
} Keyword;

/* Panggil init agar Input bisa dipakai, */
struct Input* jscan_init();

/* ... lalu buka file kode sumber, */
void jscan_open(Input* inp, const char* fn);

/* ... jangan lupa melepas memori */
void jscan_free(Input*);

/* Dalam file keyword */
Keyword *jscan_is_keyword (const char *str, unsigned int len);

/* Dalam file tokenstr */
char* jscan_tokenstr(UINT token);

UINT jscan_scan(Input *inp);

#endif /* JERUK_SCANNER_H */
